package game;

public class Logger
{
    public static synchronized void log(String message, Throwable t)
    {
        log(message, true);
        log(t, true);
    }
    
    public static synchronized void log(Object message, boolean newLine)
    {
        if (message instanceof Throwable)
        {
            System.out.println(((Throwable) message).getLocalizedMessage());
            ((Throwable) message).printStackTrace(System.out);
        }
        else
        {
            System.out.print(message.toString());
        }
        if (newLine)
        {
            System.out.println();
        }
    }
    
    public static synchronized void log(Object message)
    {
        log(message, true);
    }
}
